<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .left,
        .right {
            position: fixed;
            top: 300px;
        }

        .left {
            float: left;
            left: 0;
        }

        .right {
            float: right;
            right: 0;
        }

        img {
            display: none;
        }
    </style>
    <script src="./../jquery-1.12.4.js"></script>
    <script>
        $(function () {
            $(window).scroll(function () {
                // 获取网页滚动的偏移位
                var offset = $('html,body').scrollTop();
                if (offset >= 500) {
                    $('img').show(1000);
                } else {
                    $('img').hide(1000);
                }
            })
        })
    </script>
</head>

<body>
    <img src="./images/left_ad.png" alt="" class="left">
    <img src="./images/right_ad.png" alt="" class="right">
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
</body>

</html>